import type { WorkerBaseAction } from "./action/worker.action";
import { WorkerThreadController } from "./controller/worker.worker_thread.controller";

/**
 * worker线程实例
 */
export class WorkerThreadWorker {
    /**
     * Worker 线程通信控制器
     */
    protected controller: WorkerThreadController;

    public constructor() {
        this.controller = new WorkerThreadController();
    }

    /**
     * 初始化业务actions
     */
    public initActions() {}

    /**
     * 实例化action
     * @param Action action类
     */
    protected createAction<T extends typeof WorkerBaseAction>(Action: T): InstanceType<T> {
        return (new Action(this.controller, this)) as InstanceType<T>;
    }
}
